<?php
	include(ROOTPATH .'include'. DS .'protect.php');
	include ROOTPATH .'include'. DS .'isMyQuery.php';
	include_once( ROOTPATH .'class'. DS .'star.class.php'); 
	
	$file_id		= getId('id');
	$star			= getQuery('star');
	
	$queryCode		= getQuery('query');
	
	
	$query			= $encrypt -> recode($queryCode);
	$query 			= explode(INVITE_SPLIT_STRING , $query );	//412|-_-|111@qqq.com|-_-|2010-06-30 
	
	$task_id		= (int)$query[0];
	$invite			= $query[1];
	$timeEnd		= $query[2];
	$selectionArea	= $query[3];
	
	$isHasTask		= true ;
	$isCanAssess	= true ;
	$isAdmin		= false ;
	
	if($invite == '我是管理员' && $timeEnd == '我没有时间限制' ){
		include(ROOTPATH .'include'. DS .'checkUserLogin.php');
		$isAdmin = true ;
	}else{
	
	
		$sql 			= 'SELECT * FROM `'. DB_PRE .'task` WHERE `id` = '. $task_id ;
		$lists			= $dbs -> select($sql);
		if(count($lists) == 0 )
			//$isHasTask = false ;
			exit('<li class="error">这个任务不存在<li>');
		
		
		$sql 			= 'SELECT * FROM `'. DB_PRE .'task_invite` WHERE `task_id` = '. $task_id .' and `invite` = "'. $invite .'" and `timeEnd` = "'. $timeEnd .'" ';
		$lists			= $dbs -> select($sql);
		if(count($lists) == 0 )
			exit('<li class="error">您没有权限对此任务评分. 您没有被邀请.<li>');
			//$isCanAssess = false ;
	}
	
	$stars			= new star;
		
		
		
switch($do){	
	
	case 'star' 				:{
									if($isAdmin)
										$stars -> addAssess($file_id,$task_id,'',$user_id,'0000-00-00 00:00:00',$star) ;
									else
										$stars -> addAssess($file_id,$task_id,$invite,'',$timeEnd,$star) ;
								 }
	break;
}

	
	
?>